#include <stdio.h>
#include <unistd.h>
int main()
{
  int fds[2];
  if (pipe(fds) < 0) // 此时,fds[0] 读  ;fds[1] 写
  {
    perror("无名管道打开失败");
  }

  char message[] = "123456";

  write(fds[1], message, sizeof(message));

  char result[1024];
  int count = read(fds[0], result, sizeof(result));
  write(1, result, count); // 1 是标准输出
  printf("\n");

  return 0;
}